/**
 * Class for creating the WMS layers that the map uses.
 * @constructor
 */
function WMS() {
  
  /**
   * Creates the WMS raster layer array used by the map for zooming.
   * 
   * @param {string} wms_url The url of the land survey WMS service
   * @returns An array of WMS raster layers
   */
  this.createWMSLayers = function (wms_url) {

    var capabilities = getWmsCapabilities(wms_url),
        aL =	getWmsLayers(capabilities),
        layers = [],
        mapType = "taustakartta"; //taustakartta, yleiskartta
	
    for(var i=aL.length-1; i>-1; i--) {
      if( aL[i].name.search(mapType) > -1) {
        layers.push(new OpenLayers.Layer.WMS( aL[i].title, wms_url,{
          layers: aL[i].name
        }, {
          maxExtent: new OpenLayers.Bounds( aL[i].bounds[0], aL[i].bounds[1], aL[i].bounds[2], aL[i].bounds[3])
        }, {
          useCanvas: OpenLayers.Layer.Grid.ONECANVASPERLAYER
        }));
      };
    };
    return layers;
  }
}